import java.awt.image.BufferedImage;
import java.awt.image.CropImageFilter;
import java.awt.image.FilteredImageSource;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;


public class getImages {
	
	public static void getSpriteSheet(){
		try {
		    // Read from a file
		    File file01 = new File("Images/SpriteSheet.png");
		    Var.SpriteSheet = ImageIO.read(file01);
		    File file02 = new File("Images/Player.png");
		    Var.Player = ImageIO.read(file02);
		    
		    int x = 0, y = 0;
		    boolean getting = true;
		    int num = 0;
		    
		    while(getting == true){
		    	Var.Tiles[num] = ((BufferedImage) Var.SpriteSheet).getSubimage(x, y,16,16);
		    	if(x >= 160 && y >= 160){
		    		getting = false;
		    	}
		    	if(x >= 160){
		    		x = 0;
		    		y += 16;
		    	}else{
		    		x += 16;
		    	}		    	
		    	num++;
		    }
		} catch (IOException e) {
			System.out.println("Failed to get images, Directory might be wrong!");
		}
	}
}
